#!/bin/bash

function change_sources() {
  echo "#======= change sources.list start =======#"
  echo "Read Your Ubuntu Version："
  check_results=`grep 'VERSION="' /etc/os-release`
  url=$check_results
  UBUNTU_VERSION=${url:9:5}
  echo "Your Ubuntu Version is ${UBUNTU_VERSION}"
  if [ ${UBUNTU_VERSION} = "12.04" ] || [ ${UBUNTU_VERSION} = "14.04" ] || [ ${UBUNTU_VERSION} = "16.04" ] || [ ${UBUNTU_VERSION} = "18.04" ] || [ ${UBUNTU_VERSION} = "20.10" ]|| [ ${UBUNTU_VERSION} = "20.04" ] || [ ${UBUNTU_VERSION} = "21.04" ]; then
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    cp ./apt/${UBUNTU_VERSION}/sources.list /etc/apt/sources.list
    apt-get update && apt-get upgrade
  then
	Your Ubuntu Version not backup sourceslist
  fi
	
  echo '#======= change sources.list end =======#'
}

change_sources